<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>background-size背景的尺寸大小</title>
    <style>
      .box {
        width: 200px;
        height: 200px;
        border: 1px dotted black;
        background-image: url("../../images/fj.png");
        background-repeat: no-repeat;
        /* background-size: auto; 默认值 */
        /* background-size: 200px 200px; 宽与高 */
        /* background-size: 200px 200px; */

        /* background-size: 100% 100%; 参考父元素的宽高的百分比 */
        /* background-size: 50% 100%; */

        /* background-size: contain; contain 包含的意思；完整把图片呈现出来，不破坏宽高比例*/
        /* background-size: contain; */

        /* background-size: cover; cover 覆盖的意思；把图片填满整个元素,最优解 */
        background-size: cover;
      }
    </style>
  </head>
  <body>
    <div class="box">背景</div>
  </body>
</html>
